package com.hzjob.dao;

import org.hibernate.Query;
import org.hibernate.Session;

import com.hzjob.domain2.Tuser;
import com.hzjob.util.MySessionFactory;

public class UserDAOImpl implements UserDAO {

	@Override
	public Tuser findUserById(Integer id) {
		Session session =  MySessionFactory.currentSession(1);
		session.beginTransaction();
		Tuser user = (Tuser) session.get(Tuser.class, new Integer(1));
		session.getTransaction().commit();
		return user;
	}

	@Override
	public Tuser addUser(Tuser user) {
		Session session =  MySessionFactory.currentSession(1);
		session.beginTransaction();
		session.save(user);
		session.getTransaction().commit();
		return user;
	}

}
